trigger DiscussionForumAfterDelete on DiscussionForum__c (after delete) {
	if (!TeamUtil.currentlyExeTrigger) {
		try{
			TeamUtil.currentlyExeTrigger = true;
            
            List<String> idsForum = new List<String>();
            for (DiscussionForum__c iterForum : Trigger.old) {
                idsForum.add(iterForum.Id); 
            }
            
            List<DiscussionTopic__c> topicsList = [select Id, Name, DiscussionForum__c from DiscussionTopic__c where DiscussionForum__c in :idsForum];
            List<DiscussionMember__c> membersList = [select Id, Name, DiscussionForum__c from DiscussionMember__c where DiscussionForum__c in :idsForum];
            
            delete topicsList;
            delete membersList;
            
            
		
		} finally {
        	TeamUtil.currentlyExeTrigger = false;
		}
	}
}